import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '商品名称',
    align: "center",
    dataIndex: 'tradeName'
  },
  {
    title: '商品编码',
    align: "center",
    dataIndex: 'commodityCode'
  },
  {
    title: '商品分类',
    align: "center",
    dataIndex: 'commdityClassification'
  },
  {
    title: '规格型号',
    align: "center",
    dataIndex: 'specification'
  },
  {
    title: '供货商',
    align: "center",
    dataIndex: 'supplier'
  },
  {
    title: '商品品牌',
    align: "center",
    dataIndex: 'commodityBrand'
  },
  {
    title: '计价单价',
    align: "center",
    dataIndex: 'pricingUnitPrice'
  },
  {
    title: '采购含税单价',
    align: "center",
    dataIndex: 'purchaseIncludTax'
  },
  {
    title: '采购税率',
    align: "center",
    dataIndex: 'purchaseTaxRate'
  },
  {
    title: '采购折扣率',
    align: "center",
    dataIndex: 'purchaseDiscountRate'
  },
  {
    title: '销售单价',
    align: "center",
    dataIndex: 'salesUnitPrice'
  },
  {
    title: '销售税率',
    align: "center",
    dataIndex: 'salesTaxRate'
  },
  {
    title: '销售折扣率',
    align: "center",
    dataIndex: 'salesDiscountRate'
  },
  {
    title: '最低限价',
    align: "center",
    dataIndex: 'floorPrice'
  },
  {
    title: '商品介绍',
    align: "center",
    dataIndex: 'productIntroduction'
  },
  {
    title: '制单人ID',
    align: "center",
    dataIndex: 'creatorId'
  },
  {
    title: '制单人姓名',
    align: "center",
    dataIndex: 'creatorName'
  },
  {
    title: '是否删除',
    align: "center",
    dataIndex: 'isDelete'
  },
  {
    title: '供货周期',
    align: "center",
    dataIndex: 'supplyCycle'
  },
  {
    title: '单位',
    align: "center",
    dataIndex: 'company'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "商品名称",
    field: 'tradeName',
    component: 'Input',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '商品名称',
    field: 'tradeName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入商品名称!'},
             ];
    },
  },
  {
    label: '商品编码',
    field: 'commodityCode',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入商品编码!'},
             ];
    },
  },
  {
    label: '商品分类',
    field: 'commdityClassification',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入商品分类!'},
             ];
    },
  },
  {
    label: '规格型号',
    field: 'specification',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入规格型号!'},
             ];
    },
  },
  {
    label: '供货商',
    field: 'supplier',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入供货商!'},
             ];
    },
  },
  {
    label: '商品品牌',
    field: 'commodityBrand',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入商品品牌!'},
             ];
    },
  },
  {
    label: '计价单价',
    field: 'pricingUnitPrice',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入计价单价!'},
             ];
    },
  },
  {
    label: '采购含税单价',
    field: 'purchaseIncludTax',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入采购含税单价!'},
             ];
    },
  },
  {
    label: '采购税率',
    field: 'purchaseTaxRate',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入采购税率!'},
             ];
    },
  },
  {
    label: '采购折扣率',
    field: 'purchaseDiscountRate',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入采购折扣率!'},
             ];
    },
  },
  {
    label: '销售单价',
    field: 'salesUnitPrice',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入销售单价!'},
             ];
    },
  },
  {
    label: '销售税率',
    field: 'salesTaxRate',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入销售税率!'},
             ];
    },
  },
  {
    label: '销售折扣率',
    field: 'salesDiscountRate',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入销售折扣率!'},
             ];
    },
  },
  {
    label: '最低限价',
    field: 'floorPrice',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入最低限价!'},
             ];
    },
  },
  {
    label: '商品介绍',
    field: 'productIntroduction',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入商品介绍!'},
             ];
    },
  },
  {
    label: '制单人ID',
    field: 'creatorId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入制单人ID!'},
             ];
    },
  },
  {
    label: '制单人姓名',
    field: 'creatorName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入制单人姓名!'},
             ];
    },
  },
  {
    label: '是否删除',
    field: 'isDelete',
    component: 'Input',
  },
  {
    label: '供货周期',
    field: 'supplyCycle',
    component: 'Input',
  },
  {
    label: '单位',
    field: 'company',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
